import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/view/login/login'
import Index from '@/view/index/index'
import Information from '@/view/information/information'
import Entrepreneurship from '@/view/entrepreneurship/entrepreneurship'
import Employment from '@/view/employment/employment'
import Personal from '@/view/personal/personal'
import CourseInfo from '@/view/index/course/courseInfo'
import Lesson from '@/view/index/course/lesson'
import MenuPage from '@/view/index/course/menuPage'
import ClearAll from '@/view/clearAll'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/',
      alias: '/index',
      name: 'index',
      component: Index
    },
    {
      path: '/register',
      name: 'register',
      component: resolve => require(['@/view/login/register'], resolve)
    },
    {
      path: '/forgetpwd',
      name: 'forget password',
      component: resolve => require(['@/view/login/fogetPassword'], resolve)
    },
    {
      path: '/exam/start',
      component: resolve => require(['@/view/exam/start'], resolve)
    },
    {
      path: '/exam/test',
      alias: '/exam',
      component: resolve => require(['@/view/exam/exam'], resolve)
    },
    {
      path: '/exam/idverify',
      component: resolve => require(['@/view/exam/idverify'], resolve)
    },
    {
      path: '/exam/point',
      component: resolve => require(['@/view/exam/point'], resolve)
    },
    {
      path: '/information',
      name: 'information',
      component: Information
    },
    {
      path: '/information/detail',
      component: resolve => require(['@/view/information/infoDetail'], resolve)
    },
    {
      path: '/information/more',
      component: resolve => require(['@/view/information/more'], resolve)
    },
    {
      path: '/information/comment',
      component: resolve => require(['@/view/information/comment'], resolve)
    },
    {
      path: '/entrepreneurship',
      name: 'entrepreneurship',
      component: Entrepreneurship
    },
    {
      path: '/employment',
      name: 'employment',
      component: Employment
    },
    {
      path: '/personal',
      name: 'personal',
      component: Personal
    },
    {
      path: '/personal/setting',
      name: 'personal-setting',
      component: resolve => require(['@/view/personal/setting'], resolve)
    },
    {
      path: '/personal/setting/account',
      name: 'personal-setting-account',
      component: resolve => require(['@/view/personal/settingAccount'], resolve)
    },
    {
      path: '/personal/setting/password/change',
      name: 'personal-setting-changePassword',
      component: resolve =>
        require(['@/view/personal/settingPassword'], resolve)
    },
    {
      path: '/personal/setting/password/forget',
      name: 'personal-setting-forgetPassword',
      component: resolve =>
        require(['@/view/personal/settingPassword2'], resolve)
    },
    {
      path: '/personal/setting/message',
      alias: '/personal/setting/notice',
      name: 'personal-setting-message',
      component: resolve => require(['@/view/personal/myNotice'], resolve)
    },
    {
      path: '/personal/setting/complete',
      name: 'personal-setting-complete',
      component: resolve => require(['@/view/personal/complete'], resolve)
    },
    {
      path: '/personal/setting/complete/selection',
      name: 'personal-setting-complete-selection',
      component: resolve => require(['@/view/personal/selection'], resolve)
    },
    {
      path: '/personal/setting/fqa',
      name: 'personal-setting-fqa',
      component: resolve => require(['@/view/personal/fqa'], resolve)
    },
    {
      path: '/personal/setting/suggesion',
      name: 'personal-setting-suggesion',
      component: resolve => require(['@/view/personal/mySuggestion'], resolve)
    },
    {
      path: '/personal/setting/about',
      name: 'personal-setting-about',
      component: resolve => require(['@/view/personal/about'], resolve)
    },
    {
      path: '/personal/school/list',
      name: 'personal-school-list',
      component: resolve => require(['@/view/personal/schoolList'], resolve)
    },
    {
      path: '/personal/school/detail',
      name: 'personal-school-detail',
      component: resolve => require(['@/view/personal/schoolDetail'], resolve)
    },
    {
      path: '/personal/school/region',
      name: 'personal-school-region',
      component: resolve => require(['@/view/personal/region'], resolve)
    },
    {
      path: '/personal/school/punchcard',
      name: 'personal-school-punchcard',
      component: resolve => require(['@/view/personal/punchCard'], resolve)
    },
    {
      path: '/personal/school/punchhistory',
      name: 'personal-school-punchhistory',
      component: resolve => require(['@/view/personal/punchHistory'], resolve)
    },
    {
      path: '/index/courseInfo',
      name: 'courseInfo',
      component: CourseInfo
    },
    {
      path: '/index/menuPage',
      name: 'menuPage',
      component: MenuPage
    },
    {
      path: '/course/lesson',
      name: 'lesson',
      component: Lesson
    },
    {
      path: '/clearAll',
      name: 'clearAll',
      component: ClearAll
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
